<%--
  Created by IntelliJ IDEA.
  User: 86188
  Date: 2023/8/21
  Time: 10:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="path" value="${pageContext.request.contextPath }"/>
<html>
<head>
    <title>用户修改列表</title>
<%--    <link href="${path}/css/wqlCss/edituser.css " rel="stylesheet" type="text/css">--%>
    <script src="${path}/js/jquery-3.6.4.js"></script>
    <style>
        .box1{
            width: 850px;
            height: 500px;
            background-color: white;
            margin-top: -30px;
            border-radius: 3px 3px 3px 3px;
        }
        img{
            width: 60px;
            height: 60px;
        }
        .action .t{
            height:50px;
            width: 60%;
            background:url(${path}/images/backIndex/right_bg.gif) no-repeat;
            font:10px 宋体;
            padding:10px 0 0 30px;
        }
        .but {
            width: 80px;
            height: 40px;
            border-radius: 5px 5px 5px 5px;
            position: relative;
            left: 37px;
            top: 10px;
        }
        .bu1{
            width: 500px;
            height: 45px;
            position: relative;
        }
        .b1{
            width: 100px;
            height: 40px;
            text-align: center;
            line-height: 35px;
            display: inline-block;
            margin-bottom: 10px;
            margin-left: 165px;
            background-color: #00cc9c;
            color: white;
            border-radius: 3px 3px 3px 3px;
            font-size: 12px;
            position: relative;
            top: 5px;
            border: 0px;
        }
        #file {
            opacity: 0.0;
            margin-bottom: 10px;
            width: 80px;
            height: 40px;
            position: relative;
            right: 48px;
            bottom: 3px;
        }
        .table{
            border: 0px gainsboro;
            border-collapse: collapse;
            margin: 0px auto;
            width: 750px;
            height: 400px;
        }
        .td{
            width: 100px;
            height: 50px;
            background-color: aliceblue;
            text-align: center;
        }
        .select{
            width: 500px;
            height: 45px;
        }
    </style>
</head>
<body>
<c:set var="mu" value="${requestScope.manageUser}"/>
<div class="action divaction">
    <div class="t">
        修改员工信息
    </div>
    <div class="box1">
        <form action="${path}/ManageuserServlet?prom=updata&mana_id=${mu.mana_id}" method="post" onsubmit="return checkInfo()"enctype="multipart/form-data">
            <table border="1" class="table">
                <tr>
                    <td style="text-align: center;">
                        <img id="mana_photo" src="${path}/images/userAvatar/${mu.mana_photo}">
                    </td>
                    <td>
                        <input type="button" class="but" value="选择文件">
                        <input type="file" id="file" name="mana_photo"multiple="multiple" value="${mu.mana_photo}"/>
                    </td>
                </tr>
                <tr>
                    <td  class="td">员工用户名:</td>
                    <td><input type="text" class="bu1" id="mana_name" name="mana_name" value="${mu.mana_name}"/></td>
                </tr>
                <tr>
                    <td  class="td">员工权限：</td>
                    <td>
                        <c:if test="${mu.mana_role=='超级管理员'}">
                            <input type="radio" name="mana_role" checked value="超级管理员">超级管理员
                            <input type="radio" name="mana_role" value="普通管理员">普通管理员
                        </c:if>
                        <c:if test="${mu.mana_role=='普通管理员'}">
                            <input type="radio" name="mana_role" value="超级管理员">超级管理员
                            <input type="radio" name="mana_role" checked value="普通管理员">普通管理员
                        </c:if>
                    </td>
                </tr>
                <tr>
                    <td  class="td">员工状态：</td>
                    <td>
                        <c:if test="${mu.mana_state=='1'}">
                            <input type="radio" value="1" name="mana_state" checked/>正常
                            <input type="radio" value="2" name="mana_state"/>异常
                        </c:if>
                        <c:if test="${mu.mana_state=='0'}">
                            <input type="radio" value="1" name="mana_state" />正常
                            <input type="radio" value="2" name="mana_state" checked/>异常
                        </c:if>
                    </td>
                </tr>
                <tr>
                    <td  class="td">员工性别:</td>
                    <td>
                        <c:if test="${mu.mana_sex=='男'}">
                            <input type="radio" value="1" name="mana_sex" checked/>男
                            <input type="radio" value="2" name="mana_sex" />女
                        </c:if>
                        <c:if test="${mu.mana_sex=='女'}">
                            <input type="radio" value="男" name="mana_sex" />男
                            <input type="radio" value="女" name="mana_sex" checked/>女
                        </c:if>
                    </td>
                </tr>
                <tr>
                    <td  class="td">员工手机号:</td>
                    <td> <input type="text" class="bu1" id="mana_phone" name="mana_phone" value="${mu.mana_phone}"/></td>
                </tr>
                <tr>
                    <td  class="td">员工邮箱:</td>
                    <td><input type="text" class="bu1" id="mana_email" name="mana_email" value="${mu.mana_email}"/></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="submit" value="修改" class="b1"/>
                        <input type="button" value="返回" class="b1" onclick="javascript:window.location='userlist.jsp'"/>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>
<script>
    $("#file").change(function () {
        //获取文件名称
        var url=document.getElementById('file').files[0].name;
        $("#mana_photo").attr("src","${path}/images/userAvatar/"+url);
        //获取文件全部路径
        var urlPath=document.getElementById('file').value;
    });

    function checkInfo(){
        let phone=$("#mana_phone").val();
        phone_format=/^1\d{10}$/;
        if(!phone_format.test(phone)){
            alert("请输入正确的手机号")
            return false;
        }
        return true;
    }
</script>
</body>
</html>
